<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('counter-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('/counter/_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('MyGridView', array(
	'id'=>'counter-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'time',
		array(
			'name'=>'world_in',
			'value'=>'$data->world_in',
			//'type'=>'number',
			'htmlOptions'=>array('class'=>'sum','id'=>'world_in'),
			'footer'=>$model->getTotals()->world_in,
			'footerHtmlOptions'=>array('class'=>'total3','id'=>'world_in'),
		),
		array(
			'name'=>'world_out',
			'value'=>'$data->world_out',
			//'type'=>'number',
			'htmlOptions'=>array('class'=>'sum','id'=>'world_out'),
			'footer'=>$model->getTotals()->world_out,
			'footerHtmlOptions'=>array('class'=>'total3','id'=>'world_out'),
		),
		array(
			'name'=>'ukraine_in',
			'value'=>'$data->ukraine_in',
			//'type'=>'number',
			'htmlOptions'=>array('class'=>'sum','id'=>'ukraine_in'),
			'footer'=>$model->getTotals()->ukraine_in,
			'footerHtmlOptions'=>array('class'=>'total3','id'=>'ukraine_in'),
		),
		array(
			'name'=>'ukraine_out',
			'value'=>'$data->ukraine_out',
			//'type'=>'number',
			'htmlOptions'=>array('class'=>'sum','id'=>'ukraine_out'),
			'footer'=>$model->getTotals()->ukraine_out,
			'footerHtmlOptions'=>array('class'=>'total3','id'=>'ukraine_out'),
		),
		array(
			'name'=>'cost',
			'value'=>'$data->cost',
			//'type'=>'number',
			'htmlOptions'=>array('class'=>'sum','id'=>'cost'),
			'footer'=>$model->getTotals()->cost,
			'footerHtmlOptions'=>array('class'=>'total2','id'=>'cost'),
		),
		array(
			'name'=>'packet_id',
			'value'=>'$data->packet->name',
			//'filter'=>$serviceModel->packet->findAll,
		),
		array(
			'name'=>'is_aggregated',
			//'value'=>'$data->is_aggregated',
			'filter'=>Lookup::items('Boolean'),
		),
	),
)); ?>
